<%
# Copyright (C) 2014 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% if association.lock_at || association.unlock_at %>
  <li>
    <span class="title">{{#t}}Available{{/t}}</span>
    <span class="value">
      <% if association.lock_at && association.unlock_at %>
        <%= mt(:quiz_available_through, "%{start_time} - %{end_time}", :start_time => datetime_string(association.unlock_at), :end_time => datetime_string(association.lock_at)) %>
        <span style="font-size: 0.8em;"><%= time_ago_in_words(Time.now + (association.lock_at - association.unlock_at)) rescue "" %></span>
      <% elsif association.lock_at %>
        <%= t(:quiz_available_until, "until %{end_time}", :end_time => datetime_string(association.lock_at)) %>
      <% else %>
        <%= t(:quiz_available_after, "after %{start_time}", :start_time => datetime_string(association.unlock_at)) %>
      <% end %>
    </span>
  </li>
<% end %>